﻿tileActor = gamvas.Actor.extend({
    create: function (name, x, y, char) {
        this._super(name, x, y, char);
        var st = gamvas.state.getCurrentState();
        this.setFile(st.resource.getImage(baseURL + 'Content/images/tile.png'));
        this.x = x;
        this.y = y;
        this.show = false;
        this.letter = char;
        this.visible = true;
    },

    draw: function (t) {
        if (this.visible)
            this._super(t);
    }
});

scoreboxActor = gamvas.Actor.extend({
    
    create: function (name, x, y, score, c) {
        this._super(name, x, y, score);
        var st = gamvas.state.getCurrentState();
        this.scorebox = st.resource.getImage(baseURL + 'Content/images/scorebox.png');
        this.scorebox_Glow = st.resource.getImage(baseURL + 'Content/images/scorebox_glow.png');
        this.setFile(this.scorebox);
        this.x = x;
        this.y = y;
        this.score = score;
        this.visible = true;
        this.ctx = c;
    },

    draw: function (t) {
        if (this.visible) {
            this._super(t);

            var dim = gamvas.getCanvasDimension();
            this.ctx.save();
            this.ctx.fillStyle = '#fff';
            this.ctx.font = 'bold 25px sans-serif';
            this.ctx.textAlign = 'right';
            this.ctx.fillText(this.score, this.x + 170, this.y + 30);
            this.ctx.restore();
        }
    },
    setSelected: function(selected) {
        var st = gamvas.state.getCurrentState();
        if(!selected)
            this.setFile(this.scorebox);
        else
            this.setFile(this.scorebox_Glow);
    }
});

wheelActor = gamvas.Actor.extend({
    create: function (name, x, y) {
        this._super(name, x, y);
        this.values = [5000, 600, 500, 300, 500, 800, 550, 400, 300, 900, 500, 300, 900, -1, 600, 400, 300, -2, 800, 350, 450, 700, 300, 600];
        var st = gamvas.state.getCurrentState();
        this.setFile(st.resource.getImage(baseURL + 'Content/images/wheel.png'));
        this.setCenter(128, 128);
        this.rotVelocity = 0;
        this.friction = 0.98;
        this.visible = true;
    },

    draw: function (t) {
        if (this.visible)
            this._super(t);
        this.rotVelocity = this.rotVelocity * this.friction;
        var rotSpeed = this.rotVelocity * t;
        if (rotSpeed < 0.001)
            this.rotVelocity = 0;
        this.rotate(rotSpeed);
    }
});
